'''
test the CSI camera on raspberry with openCV
'''

import numpy as np
import cv2

def cam():

    # 0: use CSI camera,1：use USB camera
    cap = cv2.VideoCapture(0)
    if(not cap.isOpened()):
        print("can't open this camera")

    while(True):
        ret, FrameImage = cap.read()
        if ret == True:
            # change to gray image
            GrayImage = cv2.cvtColor(FrameImage,cv2.COLOR_BGR2GRAY)
            # average filter
            BlurImage = cv2.blur(GrayImage,(7,7))
            # detect contour
            CannyImage = cv2.Canny(BlurImage,3,9)
            cv2.imshow('Camera Capture',CannyImage)
            if (cv2.waitKey(1)) == ord('q'):
                cap.release()
                break

        else:
            break




if __name__ == '__main__':

    # print("zhh")
    # print("OpenCV Version:{}".format(cv2.__version__))

    # cam()
    #  # Release resource
    # cv2.destroyAllWindows()
    dic = {}
    dic['name'] = 'zhh'
    print(dic['name'])

    lists = []
    print(len(lists))




    

